<template>
    <div>
        <!-- 轮播图 -->
        <mt-swipe :auto="2000">
            <!-- 在组件中使用 v-for一定要设置 key值 -->
            <mt-swipe-item v-for="item in SwipeList" :key="item.id">
                <img :src="item.img_url">
            </mt-swipe-item>
        </mt-swipe>

        <ul class="mui-table-view mui-grid-view mui-grid-9">
            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4">
                <router-link to="/home/newslist">
                    <span class="mui-icon fa-rocket fas"></span>
                    <div class="mui-media-body">新闻资讯</div></router-link></li>
            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4"><router-link to="/home/photolist">
                    <span class="mui-icon fa-images fas"></span>
                    <div class="mui-media-body">图片分享</div></router-link></li>
            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4"><routerLink to="/home/goodslist">
                    <span class="mui-icon fa-shopping-cart fas"></span>
                    <div class="mui-media-body">商品购买</div></routerLink></li>
            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4"><a href="#">
                    <span class="mui-icon fa-edit fas"></span>
                    <div class="mui-media-body">留言反馈</div></a></li>
            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4"><a href="#">
                    <span class="mui-icon fa-video fas"></span>
                    <div class="mui-media-body">视频专区</div></a></li>
            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-4"><a href="#">
                    <span class="mui-icon fa-phone-alt fas"></span>
                    <div class="mui-media-body">联系我们</div></a></li>
        </ul> 
    </div>
</template>

<script>
    export default {
        name: "Home",
        data() {
            return {
                SwipeList: []
            }
        },
        methods: {
            getSwipe() {  // 获取轮播图数据
                let url = "https://www.fastmock.site/mock/3bcb60e708abec194c722ac5464b28d8/VueApp/getswipe"
                this.$http.get(url).then(result=>{
                    if(result.status == 200){ // 请求成功
                        this.SwipeList = result.data.images
                    } else{

                    }
                })
            }
        },
        created() {
            this.getSwipe()
        },
    }
</script>

<style scoped lang="scss">
    .mint-swipe{
        height: 200px;
        overflow: hidden;

        .mint-swipe-item {
            background-color: #000;
            img{
                width: 100%;
                // transform: scale(1.1) ;
            }
        }
    }
    
    .mui-grid-view.mui-grid-9{
        background-color: #fff;
        border: none;
        
        .mui-table-view-cell{
            border: none;
        }
        .fas{
            color: crimson;
            font-size: 22px !important;
        }
        .mui-table-view-cell .mui-media-body{
            font-size: 14px;
        }
    }
   
</style>
